}
unsigned long
-gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
{
unsigned long va, tabpfn;
l1_pgentry_t *l1, l1e;
ASSERT(shadow_mode_translate(d));
- perfc_incrc(gpfn_to_mfn_foreign);
+ perfc_incrc(get_mfn_from_pfn_foreign);
va = gpfn << PAGE_SHIFT;
tabpfn = pagetable_get_pfn(d->arch.phys_table);
}
unsigned long
-gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
{
unsigned long va, tabpfn;
l1_pgentry_t *l1, l1e;
ASSERT(shadow_mode_translate(d));
- perfc_incrc(gpfn_to_mfn_foreign);
+ perfc_incrc(get_mfn_from_pfn_foreign);
va = gpfn << PAGE_SHIFT;
tabpfn = pagetable_get_pfn(d->arch.phys_table);
#define __mfn_to_gpfn(_d, mfn) \
( (shadow_mode_translate(_d)) \
- ? get_pfn_from_mfn(mfn) \
+ ? get_pfn_from_mfn(mfn) \
: (mfn) )
#define __gpfn_to_mfn(_d, gpfn) \
({ \
- (shadow_mode_translate(_d)) \
- ? get_mfn_from_pfn(gpfn) \
+ unlikely(shadow_mode_translate(_d)) \
+ ? (likely(current->domain == (_d)) \
+ ? get_mfn_from_pfn(gpfn) \
+ : get_mfn_from_pfn_foreign(_d, gpfn)) \
: (gpfn); \
})
-#define __gpfn_to_mfn_foreign(_d, gpfn) \
- ( (shadow_mode_translate(_d)) \
- ? gpfn_to_mfn_foreign(_d, gpfn) \
- : (gpfn) )
-
-extern unsigned long gpfn_to_mfn_foreign(
+extern unsigned long get_mfn_from_pfn_foreign(
struct domain *d, unsigned long gpfn);
/************************************************************************/
if ( l2e_get_flags(gpde) & _PAGE_PRESENT )
{
- if ( unlikely((current->domain != d) && !shadow_mode_external(d)) )
- {
- // Can't use __gpfn_to_mfn() if we don't have one of this domain's
- // page tables currently installed.
- // This isn't common -- it only happens during shadow mode setup
- // and mode changes.
- //
- mfn = gpfn_to_mfn_foreign(d, pfn);
- }
- else
- mfn = __gpfn_to_mfn(d, pfn);
-
+ mfn = __gpfn_to_mfn(d, pfn);
if ( VALID_MFN(mfn) && (mfn < max_page) )
hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
}
PERFCOUNTER_CPU(validate_hl2e_calls, "calls to validate_hl2e_change")
PERFCOUNTER_CPU(validate_hl2e_changes, "validate_hl2e makes changes")
PERFCOUNTER_CPU(exception_fixed, "pre-exception fixed")
-PERFCOUNTER_CPU(gpfn_to_mfn_foreign, "calls to gpfn_to_mfn_foreign")
+PERFCOUNTER_CPU(get_mfn_from_pfn_foreign, "calls to get_mfn_from_pfn_foreign")
PERFCOUNTER_CPU(remove_all_access, "calls to remove_all_access")
PERFCOUNTER_CPU(remove_write_access, "calls to remove_write_access")
PERFCOUNTER_CPU(remove_write_access_easy, "easy outs of remove_write_access")